﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                    xmlns:Controls="clr-namespace:WP7Contrib.View.Controls"
                    xmlns:jumpList="clr-namespace:WP7Contrib.View.Controls.JumpList"
                    xmlns:Sliders="clr-namespace:WP7Contrib.View.Controls.Sliders"
                    xmlns:local="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
                    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
                    xmlns:Reader="clr-namespace:WP7Contrib.View.Controls.Reader"
                    mc:Ignorable="d">

    <Style TargetType="Image"
           x:Key="PrimaryCachedImageStyle" />

    <Style TargetType="Controls:NavigationList">
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <VirtualizingStackPanel Orientation="Vertical"/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Controls:NavigationList">
                    <ScrollViewer>
                        <ItemsPresenter/>
                    </ScrollViewer>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="Controls:DeferredLoadContentControl">
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Controls:DeferredLoadContentControl">
                    <Grid>
                        <ContentPresenter  x:Name="contentPresenter"
                                           Visibility="Collapsed"
                                           Content="{TemplateBinding Content}"
                                           ContentTemplate="{TemplateBinding ContentTemplate}"
                                           VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                           HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                           Margin="{TemplateBinding Padding}"/>
                        <!-- the following content will be visible whilst the contents of the above ContentPresenter
                             is being 'rendered' -->
                        <Grid  x:Name="loadingIndicator">
                            <toolkit:PerformanceProgressBar IsIndeterminate="True"/>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="Controls:TransitioningContentControl">
        <Setter Property="IsTabStop"
                Value="True" />
        <Setter Property="HorizontalContentAlignment"
                Value="Left" />
        <Setter Property="VerticalContentAlignment"
                Value="Top" />
        <Setter Property="Transition"
                Value="DefaultTransition" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Controls:TransitioningContentControl">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CornerRadius="2">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="PresentationStates">
                                <VisualState x:Name="DefaultTransition">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="CurrentContentPresentationSite"
                                                                       Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00"
                                                                  Value="0" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.300"
                                                                  Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="PreviousContentPresentationSite"
                                                                       Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00"
                                                                  Value="1" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.300"
                                                                  Value="0" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Normal">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="PreviousContentPresentationSite"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>

                                <VisualState x:Name="UpTransition">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="CurrentContentPresentationSite"
                                                                       Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00"
                                                                  Value="0" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:01.000"
                                                                  Value="1" />
                                        </DoubleAnimationUsingKeyFrames>

                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="CurrentContentPresentationSite"
                                                                       Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00"
                                                                  Value="30" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:01.000"
                                                                  Value="0" />
                                        </DoubleAnimationUsingKeyFrames>

                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="PreviousContentPresentationSite"
                                                                       Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00"
                                                                  Value="1" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:01.000"
                                                                  Value="0" />
                                        </DoubleAnimationUsingKeyFrames>

                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="PreviousContentPresentationSite"
                                                                       Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00"
                                                                  Value="0" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:01.000"
                                                                  Value="-30" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>

                                <VisualState x:Name="DownTransition">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="CurrentContentPresentationSite"
                                                                       Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00"
                                                                  Value="0" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:01.000"
                                                                  Value="1" />
                                        </DoubleAnimationUsingKeyFrames>

                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="CurrentContentPresentationSite"
                                                                       Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00"
                                                                  Value="-40" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:01.000"
                                                                  Value="0" />
                                        </DoubleAnimationUsingKeyFrames>

                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="PreviousContentPresentationSite"
                                                                       Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00"
                                                                  Value="1" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:01.000"
                                                                  Value="0" />
                                        </DoubleAnimationUsingKeyFrames>

                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                       Storyboard.TargetName="PreviousContentPresentationSite"
                                                                       Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00"
                                                                  Value="0" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:01.000"
                                                                  Value="40" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>

                                <VisualState x:Name="PhoneLeftFlyout">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.CenterOfRotationY)"
                                                                       Storyboard.TargetName="PreviousContentPresentationSite">
                                            <EasingDoubleKeyFrame KeyTime="0"
                                                                  Value="0.5" />
                                            <EasingDoubleKeyFrame KeyTime="0:0:1.2"
                                                                  Value="0.5" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)"
                                                                       Storyboard.TargetName="PreviousContentPresentationSite">
                                            <EasingDoubleKeyFrame KeyTime="0"
                                                                  Value="0" />
                                            <EasingDoubleKeyFrame KeyTime="0:0:1.2"
                                                                  Value="90">
                                                <EasingDoubleKeyFrame.EasingFunction>
                                                    <ExponentialEase EasingMode="EaseOut" />
                                                </EasingDoubleKeyFrame.EasingFunction>
                                            </EasingDoubleKeyFrame>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>

                            </VisualStateGroup>

                        </VisualStateManager.VisualStateGroups>

                        <Grid>

                            <ContentPresenter x:Name="CurrentContentPresentationSite"
                                              Content="{x:Null}"
                                              ContentTemplate="{TemplateBinding ContentTemplate}"
                                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                                <ContentPresenter.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform />
                                        <SkewTransform />
                                        <RotateTransform />
                                        <TranslateTransform />
                                    </TransformGroup>
                                </ContentPresenter.RenderTransform>
                                <ContentPresenter.Projection>
                                    <PlaneProjection />
                                </ContentPresenter.Projection>
                            </ContentPresenter>

                            <ContentPresenter x:Name="PreviousContentPresentationSite"
                                              ContentTemplate="{TemplateBinding ContentTemplate}"
                                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                                <ContentPresenter.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform />
                                        <SkewTransform />
                                        <RotateTransform />
                                        <TranslateTransform />
                                    </TransformGroup>
                                </ContentPresenter.RenderTransform>
                                <ContentPresenter.Projection>
                                    <PlaneProjection CenterOfRotationX="0" />
                                </ContentPresenter.Projection>
                            </ContentPresenter>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="PhoneSimpleRepeatButton"
                     TargetType="RepeatButton">
        <Rectangle />
    </ControlTemplate>

    <ControlTemplate x:Key="PhoneSimpleThumbHorizontal"
                     TargetType="Thumb">
        <Border Background="Transparent"
                Margin="-480,-18">
            <Rectangle Width="2"
                       Height="6"
                       Fill="{StaticResource PhoneForegroundBrush}" />
        </Border>
    </ControlTemplate>

    <ControlTemplate x:Key="PhoneSimpleThumbVertical"
                     TargetType="Thumb">
        <Border Background="Transparent"
                Margin="-6,-800">
            <Rectangle Width="6"
                       Height="2"
                       Margin="24,0,0,0"
                       Fill="{StaticResource PhoneForegroundBrush}" />
        </Border>
    </ControlTemplate>

    <Style x:Key="SliderStyle"
           TargetType="Sliders:PhoneSlider">
        <Setter Property="BorderThickness"
                Value="0" />
        <Setter Property="BorderBrush"
                Value="Transparent" />
        <Setter Property="Maximum"
                Value="10" />
        <Setter Property="Minimum"
                Value="0" />
        <Setter Property="Value"
                Value="0" />
        <Setter Property="Margin"
                Value="{StaticResource PhoneHorizontalMargin}" />
        <Setter Property="Background"
                Value="{StaticResource PhoneContrastBackgroundBrush}" />
        <Setter Property="Foreground"
                Value="{StaticResource PhoneAccentBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Sliders:PhoneSlider">
                    <Grid Background="Transparent">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="HorizontalTrack"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0.1" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="VerticalTrack"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0.1" />
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalFill"
                                                                       Storyboard.TargetProperty="Fill">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                    Value="{StaticResource PhoneDisabledBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalFill"
                                                                       Storyboard.TargetProperty="Fill">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                    Value="{StaticResource PhoneDisabledBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid x:Name="HorizontalTemplate">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="0" />
                                <ColumnDefinition Width="auto" />
                            </Grid.ColumnDefinitions>
                            <Rectangle x:Name="HorizontalTrack"
                                       IsHitTestVisible="False"
                                       Fill="{TemplateBinding Background}"
                                       Opacity="0.2"
                                       Grid.ColumnSpan="3"
                                       Height="12"
                                       Margin="0,22,0,50" />
                            <Rectangle x:Name="HorizontalFill"
                                       IsHitTestVisible="False"
                                       Fill="{TemplateBinding Foreground}"
                                       Grid.Column="0"
                                       Height="12"
                                       Margin="0,22,0,50" />
                            <RepeatButton x:Name="HorizontalTrackLargeChangeDecreaseRepeatButton"
                                          IsTabStop="False"
                                          Template="{StaticResource PhoneSimpleRepeatButton}"
                                          Grid.Column="0" />
                            <RepeatButton x:Name="HorizontalTrackLargeChangeIncreaseRepeatButton"
                                          IsTabStop="False"
                                          Template="{StaticResource PhoneSimpleRepeatButton}"
                                          Grid.Column="2" />
                            <Thumb x:Name="HorizontalThumb"
                                   Width="1"
                                   Margin="-1,0,0,0"
                                   Grid.Column="1"
                                   Template="{StaticResource PhoneSimpleThumbHorizontal}"
                                   RenderTransformOrigin="0.5,0.5"
                                   CacheMode="BitmapCache" />
                        </Grid>
                        <Grid x:Name="VerticalTemplate">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="0" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Rectangle x:Name="VerticalTrack"
                                       IsHitTestVisible="False"
                                       Fill="{TemplateBinding Background}"
                                       Opacity="0.2"
                                       Grid.RowSpan="3"
                                       Width="12"
                                       Margin="24,0" />
                            <Rectangle x:Name="VerticalFill"
                                       IsHitTestVisible="False"
                                       Fill="{TemplateBinding Foreground}"
                                       Grid.Row="2"
                                       Width="12"
                                       Margin="24,0" />
                            <RepeatButton x:Name="VerticalTrackLargeChangeDecreaseRepeatButton"
                                          IsTabStop="False"
                                          Template="{StaticResource PhoneSimpleRepeatButton}"
                                          Grid.Row="0" />
                            <RepeatButton x:Name="VerticalTrackLargeChangeIncreaseRepeatButton"
                                          IsTabStop="False"
                                          Template="{StaticResource PhoneSimpleRepeatButton}"
                                          Grid.Row="2" />
                            <Thumb x:Name="VerticalThumb"
                                   Height="1"
                                   Margin="0,-1,0,0"
                                   Grid.Row="1"
                                   Template="{StaticResource PhoneSimpleThumbVertical}"
                                   RenderTransformOrigin="0.5,0.5"
                                   CacheMode="BitmapCache" />
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- RANGE SLIDER -->
    <Style x:Key="RangeSliderStyle"
           TargetType="Sliders:RangeSlider">
        <Setter Property="BorderThickness"
                Value="1" />
        <Setter Property="BorderBrush"
                Value="Black" />
        <Setter Property="Background"
                Value="#7fffffff" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Sliders:RangeSlider">
                    <Border Padding="{TemplateBinding Padding}">
                        <Grid>
                            <Rectangle Height="2"
                                       Fill="Black"
                                       VerticalAlignment="Center"
                                       Margin="2.5,0,2.5,0" />
                            <Border x:Name="SelectedRangeBorder"
                                    Margin="0">
                                <Grid>
                                    <Grid.Resources>
                                        <Style x:Key="EndThumbStyle"
                                               TargetType="Thumb">
                                            <Setter Property="Background"
                                                    Value="#FF1F3B53" />
                                            <Setter Property="BorderThickness"
                                                    Value="1" />
                                            <Setter Property="IsTabStop"
                                                    Value="False" />
                                            <Setter Property="BorderBrush">
                                                <Setter.Value>
                                                    <LinearGradientBrush EndPoint="0.5,1"
                                                                         StartPoint="0.5,0">
                                                        <GradientStop Color="#FFA3AEB9"
                                                                      Offset="0" />
                                                        <GradientStop Color="#FF8399A9"
                                                                      Offset="0.375" />
                                                        <GradientStop Color="#FF718597"
                                                                      Offset="0.375" />
                                                        <GradientStop Color="#FF617584"
                                                                      Offset="1" />
                                                    </LinearGradientBrush>
                                                </Setter.Value>
                                            </Setter>
                                            <Setter Property="Template">
                                                <Setter.Value>
                                                    <ControlTemplate TargetType="Thumb">
                                                        <Grid Background="Transparent">
                                                            <VisualStateManager.VisualStateGroups>
                                                                <VisualStateGroup x:Name="CommonStates">
                                                                    <VisualState x:Name="Normal" />
                                                                    <VisualState x:Name="MouseOver">
                                                                        <Storyboard>
                                                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BackgroundAnimation"
                                                                                                           Storyboard.TargetProperty="Opacity">
                                                                                <SplineDoubleKeyFrame KeyTime="0"
                                                                                                      Value="1" />
                                                                            </DoubleAnimationUsingKeyFrames>
                                                                            <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient"
                                                                                                          Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                                                                <SplineColorKeyFrame KeyTime="0"
                                                                                                     Value="#F2FFFFFF" />
                                                                            </ColorAnimationUsingKeyFrames>
                                                                            <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient"
                                                                                                          Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)">
                                                                                <SplineColorKeyFrame KeyTime="0"
                                                                                                     Value="#CCFFFFFF" />
                                                                            </ColorAnimationUsingKeyFrames>
                                                                            <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient"
                                                                                                          Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)">
                                                                                <SplineColorKeyFrame KeyTime="0"
                                                                                                     Value="#7FFFFFFF" />
                                                                            </ColorAnimationUsingKeyFrames>
                                                                        </Storyboard>
                                                                    </VisualState>
                                                                    <VisualState x:Name="Pressed">
                                                                        <Storyboard>
                                                                            <ColorAnimationUsingKeyFrames Storyboard.TargetName="Background"
                                                                                                          Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)">
                                                                                <SplineColorKeyFrame KeyTime="0"
                                                                                                     Value="#FF6DBDD1" />
                                                                            </ColorAnimationUsingKeyFrames>
                                                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BackgroundAnimation"
                                                                                                           Storyboard.TargetProperty="Opacity">
                                                                                <SplineDoubleKeyFrame KeyTime="0"
                                                                                                      Value="1" />
                                                                            </DoubleAnimationUsingKeyFrames>
                                                                            <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient"
                                                                                                          Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
                                                                                <SplineColorKeyFrame KeyTime="0"
                                                                                                     Value="#D8FFFFFF" />
                                                                            </ColorAnimationUsingKeyFrames>
                                                                            <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient"
                                                                                                          Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                                                                <SplineColorKeyFrame KeyTime="0"
                                                                                                     Value="#C6FFFFFF" />
                                                                            </ColorAnimationUsingKeyFrames>
                                                                            <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient"
                                                                                                          Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)">
                                                                                <SplineColorKeyFrame KeyTime="0"
                                                                                                     Value="#8CFFFFFF" />
                                                                            </ColorAnimationUsingKeyFrames>
                                                                            <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient"
                                                                                                          Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)">
                                                                                <SplineColorKeyFrame KeyTime="0"
                                                                                                     Value="#3FFFFFFF" />
                                                                            </ColorAnimationUsingKeyFrames>
                                                                        </Storyboard>
                                                                    </VisualState>
                                                                    <VisualState x:Name="Disabled">
                                                                        <Storyboard>
                                                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualElement"
                                                                                                           Storyboard.TargetProperty="Opacity">
                                                                                <SplineDoubleKeyFrame KeyTime="0"
                                                                                                      Value=".55" />
                                                                            </DoubleAnimationUsingKeyFrames>
                                                                        </Storyboard>
                                                                    </VisualState>
                                                                </VisualStateGroup>
                                                                <VisualStateGroup x:Name="FocusStates">
                                                                    <VisualState x:Name="Focused">
                                                                        <Storyboard>
                                                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement"
                                                                                                           Storyboard.TargetProperty="Opacity">
                                                                                <SplineDoubleKeyFrame KeyTime="0"
                                                                                                      Value="1" />
                                                                            </DoubleAnimationUsingKeyFrames>
                                                                        </Storyboard>
                                                                    </VisualState>
                                                                    <VisualState x:Name="Unfocused" />
                                                                </VisualStateGroup>
                                                            </VisualStateManager.VisualStateGroups>
                                                            <Border x:Name="Background"
                                                                    Background="White"
                                                                    BorderBrush="{TemplateBinding BorderBrush}"
                                                                    BorderThickness="{TemplateBinding BorderThickness}"
                                                                    CornerRadius="2"
                                                                    Margin="0,5">
                                                                <Grid Margin="1"
                                                                      Background="{TemplateBinding Background}">
                                                                    <Border x:Name="BackgroundAnimation"
                                                                            Opacity="0"
                                                                            Background="#FF448DCA" />
                                                                    <Rectangle x:Name="BackgroundGradient">
                                                                        <Rectangle.Fill>
                                                                            <LinearGradientBrush EndPoint=".7,1"
                                                                                                 StartPoint=".7,0">
                                                                                <GradientStop Color="#FFFFFFFF"
                                                                                              Offset="0" />
                                                                                <GradientStop Color="#F9FFFFFF"
                                                                                              Offset="0.375" />
                                                                                <GradientStop Color="#E5FFFFFF"
                                                                                              Offset="0.625" />
                                                                                <GradientStop Color="#C6FFFFFF"
                                                                                              Offset="1" />
                                                                            </LinearGradientBrush>
                                                                        </Rectangle.Fill>
                                                                    </Rectangle>
                                                                </Grid>
                                                            </Border>
                                                            <Rectangle x:Name="DisabledVisualElement"
                                                                       Fill="#FFFFFFFF"
                                                                       RadiusX="2"
                                                                       RadiusY="2"
                                                                       IsHitTestVisible="false"
                                                                       Opacity="0"
                                                                       Margin="0,15" />
                                                            <Rectangle x:Name="FocusVisualElement"
                                                                       Stroke="#FF6DBDD1"
                                                                       StrokeThickness="1"
                                                                       RadiusX="1"
                                                                       RadiusY="1"
                                                                       Margin="1,6"
                                                                       IsHitTestVisible="false"
                                                                       Opacity="0" />
                                                            <StackPanel HorizontalAlignment="Center"
                                                                        Orientation="Horizontal"
                                                                        Margin="0,8"
                                                                        MaxHeight="10">
                                                                <Rectangle Width="1"
                                                                           Fill="Black" />
                                                                <Rectangle Fill="Black"
                                                                           Width="1"
                                                                           Margin="1,0,0,0" />
                                                            </StackPanel>
                                                        </Grid>
                                                    </ControlTemplate>
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </Grid.Resources>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>

                                    <Thumb x:Name="RangeCenterThumb"
                                           Grid.Column="1"
                                           Cursor="Hand"
                                           Margin="-5,0,-5,0"
                                           BorderBrush="{TemplateBinding BorderBrush}"
                                           BorderThickness="{TemplateBinding BorderThickness}"
                                           Background="{TemplateBinding Background}">
                                        <Thumb.Style>
                                            <Style TargetType="Thumb">
                                                <Setter Property="Template">
                                                    <Setter.Value>
                                                        <ControlTemplate TargetType="Thumb">
                                                            <Grid Background="Transparent">
                                                                <Border BorderBrush="{TemplateBinding BorderBrush}"
                                                                        BorderThickness="{TemplateBinding BorderThickness}"
                                                                        Background="{TemplateBinding Background}"
                                                                        CornerRadius="3" />
                                                            </Grid>
                                                        </ControlTemplate>
                                                    </Setter.Value>
                                                </Setter>
                                            </Style>
                                        </Thumb.Style>
                                    </Thumb>

                                    <Thumb x:Name="RangeStartThumb"
                                           Cursor="SizeWE"
                                           Width="10"
                                           Style="{StaticResource EndThumbStyle}"
                                           BorderBrush="{TemplateBinding BorderBrush}"
                                           BorderThickness="{TemplateBinding BorderThickness}" />

                                    <Thumb x:Name="RangeEndThumb"
                                           Grid.Column="2"
                                           Cursor="SizeWE"
                                           Width="10"
                                           Style="{StaticResource EndThumbStyle}"
                                           BorderBrush="{TemplateBinding BorderBrush}"
                                           BorderThickness="{TemplateBinding BorderThickness}" />

                                </Grid>
                            </Border>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="Controls:LazyListBoxItem">
        <Setter Property="Background"
                Value="Transparent" />
        <Setter Property="BorderThickness"
                Value="0" />
        <Setter Property="BorderBrush"
                Value="Transparent" />
        <Setter Property="Padding"
                Value="0" />
        <Setter Property="HorizontalAlignment"
                Value="Stretch" />
        <Setter Property="VerticalAlignment"
                Value="Stretch" />
        <Setter Property="HorizontalContentAlignment"
                Value="Stretch" />
        <Setter Property="VerticalContentAlignment"
                Value="Top" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Controls:LazyListBoxItem">
                    <Border x:Name="LayoutRoot"
                            Background="{TemplateBinding Background}"
                            HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalAlignment}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot"
                                                                       Storyboard.TargetProperty="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                    Value="{StaticResource TransparentBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimation Storyboard.TargetName="ContentContainer"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0"
                                                         To=".5" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="Unselected" />
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentContainer"
                                                                       Storyboard.TargetProperty="Foreground">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                    Value="{StaticResource PhoneAccentBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <ContentControl x:Name="ContentContainer"
                                        VerticalAlignment="Stretch"
                                        HorizontalAlignment="Stretch"
                                        VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                        HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                        Margin="{TemplateBinding Padding}"
                                        Content="{TemplateBinding Content}"
                                        ContentTemplate="{TemplateBinding ContentTemplate}"
                                        Foreground="{TemplateBinding Foreground}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="Reader:ReaderControl">
        <Setter Property="Width"
                Value="456" />
        <Setter Property="Height"
                Value="768" />
        <Setter Property="DefaultItemWidth"
                Value="456" />
        <Setter Property="DefaultItemHeight"
                Value="768" />
        <Setter Property="Foreground"
                Value="{StaticResource PhoneForegroundBrush}" />
        <Setter Property="Background"
                Value="Transparent" />

        <!-- ReaderView template -->
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Reader:ReaderControl">
                    <Canvas Name="LayoutRoot"
                            Background="{TemplateBinding Background}"
                            CacheMode="BitmapCache">

                        <StackPanel Name="BackgroundPanelHost"
                                    Orientation="Horizontal"
                                    CacheMode="BitmapCache">
                            <ContentPresenter Name="BackgroundPanel"
                                              Height="{TemplateBinding Height}"
                                              CacheMode="BitmapCache" />
                        </StackPanel>

                        <StackPanel Name="ItemsPanelHost"
                                    Orientation="Horizontal"
                                    CacheMode="BitmapCache">
                            <ItemsPresenter Name="ItemsPanel"
                                            CacheMode="BitmapCache" />
                        </StackPanel>

                    </Canvas>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <!-- ItemsPanel template -->
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="Reader:ReaderItem">
        <Setter Property="AutoSnap"
                Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Reader:ReaderItem">
                    <ContentPresenter x:Name="ReadertemContent"
                                      Width="{TemplateBinding Width}"
                                      Margin="6"
                                      CacheMode="BitmapCache" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <ItemsPanelTemplate x:Key="StackPanelTemplate">
        <VirtualizingStackPanel Orientation="Vertical"/>
    </ItemsPanelTemplate>

    <Style TargetType="jumpList:JumpListItem">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="jumpList:JumpListItem">
                    <Border x:Name="LayoutRoot"
                              Background="{TemplateBinding Background}"
                              HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                              VerticalAlignment="{TemplateBinding VerticalAlignment}"
                              BorderBrush="{TemplateBinding BorderBrush}"
                              BorderThickness="{TemplateBinding BorderThickness}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled"/>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="Unselected"/>
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames
                                              Storyboard.TargetName="ContentContainer"
                                              Storyboard.TargetProperty="Foreground">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                              Value="{StaticResource PhoneAccentBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <ContentControl x:Name="ContentContainer"
                                        VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                        HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                        Margin="{TemplateBinding Padding}"
                                        Content="{TemplateBinding Content}"
                                        ContentTemplate="{TemplateBinding ContentTemplate}"
                                        Foreground="{TemplateBinding Foreground}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="jumpList:JumpList">
        <Setter Property="JumpButtonTemplate">
            <Setter.Value>
                <ControlTemplate>
                    <Grid Background="Transparent">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ColorAnimation To="White" Duration="0:0:0"
                                                       Storyboard.TargetName="Background"
                                                       Storyboard.TargetProperty="(Rectangle.Fill).(SolidColorBrush.Color)"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled"/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Rectangle  x:Name="Background"
                                    Fill="{StaticResource PhoneAccentBrush}"/>
                        <ContentControl x:Name="ContentContainer"
                                        Foreground="{TemplateBinding Foreground}"
                                        HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                        VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                        Padding="{TemplateBinding Padding}"
                                        Content="{TemplateBinding Content}"
                                        ContentTemplate="{TemplateBinding ContentTemplate}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="CategoryButtonTemplate">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid Background="Transparent"
                            x:Name="Parent"
                            RenderTransformOrigin="0.5,0.5">
                        <Grid.Resources>
                            <Storyboard x:Key="ShowAnim">
                                <DoubleAnimation To="0" Duration="0:0:0.2"
                                                   Storyboard.TargetName="Parent"
                                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(RotateTransform.Angle)"/>
                                <DoubleAnimation To="1" Duration="0:0:0.2"
                                                   Storyboard.TargetName="Parent"
                                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(ScaleTransform.ScaleX)"/>
                                <DoubleAnimation To="1" Duration="0:0:0.2"
                                                   Storyboard.TargetName="Parent"
                                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(ScaleTransform.ScaleY)"/>
                            </Storyboard>
                            <Storyboard x:Key="HideAnim">
                                <DoubleAnimation To="120" Duration="0:0:0.2"
                                                   Storyboard.TargetName="Parent"
                                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(RotateTransform.Angle)"/>
                                <DoubleAnimation To="0" Duration="0:0:0.2"
                                                   Storyboard.TargetName="Parent"
                                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(ScaleTransform.ScaleX)"/>
                                <DoubleAnimation To="0" Duration="0:0:0.2"
                                                   Storyboard.TargetName="Parent"
                                                   Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(ScaleTransform.ScaleY)"/>
                            </Storyboard>
                        </Grid.Resources>

                        <Grid.RenderTransform>
                            <TransformGroup>
                                <RotateTransform Angle="120"/>
                                <ScaleTransform ScaleX="0" ScaleY="0"/>
                            </TransformGroup>
                        </Grid.RenderTransform>

                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ColorAnimation To="White" Duration="0:0:0"
                                                           Storyboard.TargetName="Background"
                                                           Storyboard.TargetProperty="(Rectangle.Fill).(SolidColorBrush.Color)"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation To="1" Duration="0:0:0"
                                                           Storyboard.TargetName="DisabledBackground"
                                                           Storyboard.TargetProperty="(Rectangle.Opacity)"/>
                                        <DoubleAnimation To="0" Duration="0:0:0"
                                                           Storyboard.TargetName="Background"
                                                           Storyboard.TargetProperty="(Rectangle.Opacity)"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Rectangle  x:Name="Background"
                                  Fill="{StaticResource PhoneAccentBrush}"/>
                        <Rectangle  x:Name="DisabledBackground"
                                      Fill="{StaticResource PhoneBackgroundBrush}"
                                      Opacity="0"/>
                        <ContentControl x:Name="ContentContainer"
                                        Foreground="{TemplateBinding Foreground}"
                                        HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                        VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                        Padding="{TemplateBinding Padding}"
                                        Content="{TemplateBinding Content}"
                                        ContentTemplate="{TemplateBinding ContentTemplate}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="JumpListItemStyle">
            <Setter.Value>
                <Style TargetType="jumpList:JumpListItem">
                    <Setter Property="HorizontalAlignment" Value="Left"/>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="JumpButtonStyle">
            <Setter.Value>
                <Style TargetType="Button">
                    <Setter Property="HorizontalAlignment" Value="Left"/>
                    <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                    <Setter Property="VerticalContentAlignment" Value="Stretch"/>
                    <Setter Property="Padding" Value="8"/>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="CategoryButtonStyle">
            <Setter.Value>
                <Style TargetType="Button">
                    <Setter Property="HorizontalContentAlignment" Value="Left"/>
                    <Setter Property="VerticalContentAlignment" Value="Bottom"/>
                    <Setter Property="Padding" Value="8"/>
                    <Setter Property="Margin" Value="10"/>
                    <Setter Property="Width" Value="60"/>
                    <Setter Property="Height" Value="60"/>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <TextBlock Text="{Binding}"/>
                </DataTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="JumpButtonItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <TextBlock Text="{Binding}"
                                FontSize="{StaticResource PhoneFontSizeMedium}"
                                Padding="5"
                                VerticalAlignment="Bottom"
                                HorizontalAlignment="Left"/>
                </DataTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="CategoryButtonItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <TextBlock Text="{Binding}"
                                FontSize="{StaticResource PhoneFontSizeMedium}"
                                Padding="5"
                                VerticalAlignment="Bottom"/>
                </DataTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Grid>

                        <jumpList:JumpListItemsControl x:Name="JumpListItems"
                                 ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=FlattenedCategories}">
                            <jumpList:JumpListItemsControl.Resources>
                                <Storyboard x:Key="JumpListItemsShowAnim">
                                    <DoubleAnimation To="1.0" Duration="0:0:0.5"
                                                       Storyboard.TargetName="JumpListItems"
                                                       Storyboard.TargetProperty="(ScrollViewer.Opacity)"/>
                                </Storyboard>
                                <Storyboard x:Key="JumpListItemsHideAnim">
                                    <DoubleAnimation To="0.35" Duration="0:0:0.5"
                                                       Storyboard.TargetName="JumpListItems"
                                                       Storyboard.TargetProperty="(ScrollViewer.Opacity)"/>
                                </Storyboard>
                            </jumpList:JumpListItemsControl.Resources>
                            <jumpList:JumpListItemsControl.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <VirtualizingStackPanel/>
                                </ItemsPanelTemplate>
                            </jumpList:JumpListItemsControl.ItemsPanel>
                            <jumpList:JumpListItemsControl.Template>
                                <ControlTemplate TargetType="jumpList:JumpListItemsControl">
                                    <ScrollViewer x:Name="ScrollViewer">
                                        <ItemsPresenter/>
                                    </ScrollViewer>
                                </ControlTemplate>
                            </jumpList:JumpListItemsControl.Template>
                        </jumpList:JumpListItemsControl>


                        <Grid IsHitTestVisible="False"
                              x:Name="LoadingIndicator"
                              Opacity="0">
                            <TextBlock Text="Loading ..."
                         HorizontalAlignment="Right"/>
                        </Grid>


                        <ItemsControl x:Name="CategoryItems"
                                      Visibility="Collapsed"                      
                                      ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CategoryList}">
                            <ItemsControl.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <toolkit:WrapPanel Background="Transparent"/>
                                </ItemsPanelTemplate>
                            </ItemsControl.ItemsPanel>
                            <ItemsControl.Template>
                                <ControlTemplate>
                                    <ScrollViewer x:Name="ScrollViewer">
                                        <ItemsPresenter/>
                                    </ScrollViewer>
                                </ControlTemplate>
                            </ItemsControl.Template>
                        </ItemsControl>

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>